package com.kuang.demo3.impl;

import com.kuang.demo3.Shape;

import java.util.Scanner;

/**
 * @Title:
 * @Description:
 * @Author: zx
 * @Date: create in 11:33 2020/8/7
 * @Version: 1.0
 */
public class Rectangle implements Shape {

    //宽
    public int width;
    //高
    public int height;

    @Override
    public Object clone() {
        Rectangle rectangle = null;
        try {
            rectangle = (Rectangle) super.clone();
        } catch (CloneNotSupportedException e) {
            System.out.println("拷贝正方形失败!");
        }
        return rectangle;
    }

    @Override
    public void countArea() {
        System.out.print("这是一个三角形，请输入它的底：");
        Scanner input = new Scanner(System.in);
        width = input.nextInt();
        System.out.print("这是一个三角形，请输入它的高：");
        height = input.nextInt();
        System.out.println("该三角形的面积=" + (width * height)/2 + "\n");
    }
}
